<template>
  <div class="card-container">
      <el-card :body-style="{ padding: '0px' }" >
        <div class="img-box" :style="{ backgroundColor: product.backgroundColor}">
            <div class="company-simple">{{product.companySimpleName}}</div>
            <div class="product-name"><span>{{product.productName}}</span></div>
            <div class="product-num">{{product.productNum}}</div>
        </div>
        <div class="product">
          <div class="product-info">
              <span class="title">产品介绍</span>
              <div class="content">
                {{product.productInfo}}
              </div>
          </div>
          <div class="product-info" style="margin-top:30px;">
              <span class="title">产品功能</span>
              <div class="function-list">
                <el-row type="flex" class="row-bg" justify="space-around" v-if="product.params.functionList">
                  <el-col :span="12">
                    <template v-for="(functionStr,index) in product.params.functionList">
                      <p class="function"  :key="index" v-if="index<5">
                        <i class="el-icon-check"></i><span>{{functionStr}}</span>
                      </p>
                    </template>
                  </el-col>
                  <el-col :span="12">
                    <template v-for="(functionStr,index) in product.params.functionList">
                      <p class="function-other"  :key="index+5" v-if="index>=5">
                        <i class="el-icon-check"></i><span>{{functionStr}}</span>
                      </p>
                    </template>
                  </el-col>
                </el-row>
              </div>
          </div>
          <div class="demonstration">
            <div>
              <el-button type="primary" icon="el-icon-monitor" :style="{ backgroundColor: product.backgroundColor,borderColor:product.backgroundColor}" @click.native="demoUrl(product.demonstration)">DEMO演示</el-button>
              <el-button type="primary" icon="el-icon-reading" :style="{ backgroundColor: product.backgroundColor,borderColor:product.backgroundColor}" @click.native="whiteUrl(product.whitePaper)">产品白皮书</el-button>
            </div>
            <div class="count">
                {{product.account}}
            </div>
          </div>
        </div>
      </el-card>
    </div>
</template>

<script>
import template from '../../template.vue';

export default {
  name: 'ProductCard',
  props: {
    // 值
    type: '',
    //课程封面
    product: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
     baseApi: process.env.VUE_APP_BASE_API, // 服务器地址
    };
  },
  methods: {
    demoUrl(url){
      if(!url){
         this.$message({
          message: '暂时没有演示地址！',
          type: 'warning'
        });
        return;
      }
      window.open(url);
    },
    whiteUrl(url){
      if(!url){
         this.$message({
          message: '暂时没有白皮书！',
          type: 'warning'
        });
        return;
      }
      window.location.href = this.baseApi+url;
    }
  },
  watch: {},
  created() {
  },
};
</script>

<style scoped lang="scss">
.card-container{
    
  // padding-bottom: 5px;
  min-height: 162px;
  border-radius: 5px;
  
  margin-bottom: 15px;
  ::v-deep .el-card{
    background-color: #272e48;
    border: 1px solid #272e48;
  }
  .img-box{
    width: 100%;
    height: 160px;
    overflow: hidden;
    background-color: #408CFF;
    display: flex;
    flex-direction: column;
    .company-simple{
      text-align: center;
      font-weight: 600;
      height: 50px;
      color: white;
      line-height: 50px;
    }
    .product-name{
      font-weight: bold;
      font-size: 30px;
      text-align: center;
      height: 60px;
      color: white;
      line-height: 60px;
      span{
        text-shadow: 5px 5px 5px #423535;
      }
       
    }
    .product-num{
      text-align: center;
      font-weight: 600;
      height: 50px;
      color: white;
      line-height: 50px;
    }
  }
  .product{
    padding: 30px 15px;
    background-color: #272E48;
    .product-info{
      .title{
        font-size: 16px;
        font-weight: 800;
         color: #BCD0F7;
      }
      .content{
        height: 140px;
        text-indent: 2em;
        font-size: 14px;
        color: #BCD0F7;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 7;
        overflow: hidden;
      }
      .function-list{
        height: 184px;
        .function{
          text-align: left;
          font-weight: 600;
          color: #BCD0F7;
          font-size: 14px;
          i{
            font-weight: bold;
            padding: 0 4px;
          }
        }
        .function-other{
          text-align: right;
          font-weight: 600;
          color: #BCD0F7;
          font-size: 14px;
          i{
            font-weight: bold;
            padding: 0 4px;
          }
        }
      }
    }
    .demonstration{
      padding: 10px 0;
      text-align: center;
      .count{
        text-align: center;
        color: #BCD0F7;
        font-size: 14px;
      }
    }
  }


  img{
    width: 100%;
    height: 160px;
    max-height: 160px;
    object-fit: cover;// 不变形
    display: block;
    transition: all 0.6s;
  }
  
}
</style>